<%@page import="com.bean.InstrumentBean"%>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<%
	InstrumentBean insBean = (InstrumentBean)request.getAttribute("insDetail");
%>
  <head>
    <base href="<%=basePath%>">
    
    <title>Instrument modify</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<link rel="stylesheet" type="text/css" href="CSS/style.css">
	
	<script type="text/javascript">
function check(form){
	if(form.barcode.value==""){
		alert("please enter barcode");form.barcode.focus();
		return false;
	}
	if(!/^\d+$/.test(form.barcode.value))
	  {alert('barcode is illegal,number is ok');form.barcode.focus();
	  return false;}
	
	if(!/^[A-Za-z0-9]+$/.test(form.name.value)){
		alert("instrument name is illegal");form.name.focus();
		return false;
	}
	if(form.price.value!="" && !/^\d+(\.\d\d)?$/.test(form.price.value)){
		alert(" price with number is expected");form.price.focus();
		return false;
	}
	form.submit();
}

</script>
</head>


<body>

<table width="778"  border="0" cellspacing="0" cellpadding="0" align="center">
  <tr>
    <td valign="top" bgcolor="#FFFFFF">
    <table width="99%" height="510"  border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" class="tableBorder_gray">
  <tr>
    <td height="510" valign="top" style="padding:5px;">
    <table width="98%" height="487"  border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td height="22" valign="top" class="current_addr">Current address：Instrument &gt;&gt; Modify</td>
      </tr>
      <tr>
        <td align="center" valign="top">
        <table width="100%" height="300"  border="0" cellpadding="0" cellspacing="0">
 	 <tr>
    <td align="center" valign="top">
<%
String barcode = "";
String name = "";
String price = "";
String remark = "";
if(insBean!=null)
{
 barcode = insBean.getBarcode();
 name = insBean.getName();
 price = insBean.getPrice();
 remark = insBean.getRemark();
}
%>

	<form name="modifyform" method="post" action="InstrumentModifyServlet?option=commit">
	<table width="600"   border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
      
      <tr>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      </tr>
      
      <tr>
        <td width="100" align="center" class="attr">Barcode：</td>
        <td width="427" height="35">
         <input name="barcode" type="text" id="barcode" maxlength="45" value="<%=barcode%>">
         <font color="red">* </font>numbers is ok.maxlength is 45
         </td>
      </tr>
      <tr>
        <td width="100" align="center" class="attr">Name：</td>
        <td width="427" height="35">
        <input name="name" type="text" value="<%=name%>" maxlength="100" size="30">
          <font color="red">*</font> only charactors or numbers are expected</td>
      </tr>  
      <tr>
        <td width="100" align="center" class="attr">Price：</td>
        <td width="427" height="35"> 
        <input name="price" type="text" id="price" value = "<%=price%>" maxlength="10">
         
         KR &nbsp;&nbsp;integer,decimal,rounded to two decimals.</td>
      </tr>
     <tr>
        <td align="center" class="attr">Remark：</td>
        <td><textarea name="remark" cols="50" rows="5" id="remark" style="overflow-y:auto; resize: none;"><%=remark %></textarea></td>
      </tr>
      <tr>
        <td align="center">&nbsp;</td>
        <td height="35">
        <input type="button" class="btn" value="save" onClick="return check(modifyform);">
&nbsp;
<input name="reset" type="reset" class="btn" value="back" onClick="history.back()"></td>
      </tr>
    </table>
	</form>
	</td>
  </tr>
</table></td>
      </tr>
    </table>
</td>
  </tr>
</table></td>
  </tr>
</table>

</body>
</html>
